
import {PropType} from 'vue'
//抽屉打开方向
export type DrawerDirType='ltr'|'rtl'|'ttb'|'btt'
//关闭前回调
export type BeforeClose=(done: () => void)=>void

const defaultBeforeClose:BeforeClose = (done: () => void) => {
  done()
}

export const DrawerProps = {
  //显示抽屉
  showDrawer:{
    type:Boolean,
    required:true
  },
  //抽屉标题
  title:{
    type:String,
    required:true
  },
  //滑出方向
  direction:{
    type:String as PropType<DrawerDirType>,
    default:'rtl'
  },
  //抽屉大小
  size:{
    type:[String, Number],
    default:640
  },
  //关闭前回调
  beforeClose:{
    type:Function as PropType<BeforeClose>,
    default:defaultBeforeClose
  }
}

export const DrawerEmits = ['cancel', 'confirm', 'open', 'close']